# -*- coding: utf-8 -*-

import warnings

import pandas as pd
import numpy as np
from sklearn import preprocessing

from ..base import CommonFunction


class DataTransforming(CommonFunction):
    def normalization(self):
        scaler = preprocessing.MinMaxScaler()
        self._data = pd.DataFrame(scaler.fit_transform(self._data), columns=self._data.columns.values)
        return scaler

    def standardization(self):
        scaler = preprocessing.StandardScaler()
        self._data = pd.DataFrame(scaler.fit_transform(self._data), columns=self._data.columns.values)
        return scaler

    def zero_centered(self):
        scaler = preprocessing.StandardScaler()
        self._data = pd.DataFrame(scaler.fit_transform(self._data, with_std=False), columns=self._data.columns.values)
        return scaler

    def log_scale(self):
        scaler = preprocessing.FunctionTransformer(np.log1p)
        self._data = pd.DataFrame(scaler.fit_transform(self._data), columns=self._data.columns.values)
        return scaler
